//
//  DoctorInfoCollectionViewCell.m
//  QuickCure
//
//  Created by 凉气的Mac on 16/9/13.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "DoctorInfoCollectionViewCell.h"

#import <UIImageView+WebCache.h>

@interface DoctorInfoCollectionViewCell ()

/**
 *  医生头像
 */
@property(nonatomic,weak) UIImageView *doctorIcon;

/**
 *  医生姓名
 */
@property(nonatomic,weak) UILabel *nameLabel;

/**
 *  医院
 */
@property(nonatomic,weak) UILabel *hospitalLabel;

@end

@implementation DoctorInfoCollectionViewCell


-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        //设置界面
        [self setupUI];
    }
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{
    
    //医生头像
    UIImageView *doctorIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"illness_img_person.png"]];
    self.doctorIcon = doctorIcon;
    
    doctorIcon.layer.cornerRadius = 35;
    doctorIcon.clipsToBounds = YES;
    
    [self.contentView addSubview:doctorIcon];
    
    [doctorIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(self.contentView).offset(15);
        make.width.height.equalTo(70);
    }];
    
    
    //医生姓名
    UILabel *nameLabel = [[UILabel alloc]init];
    self.nameLabel = nameLabel;
    
    nameLabel.text = @"name";
    nameLabel.font = BOLDFONT(13);
    
    [self.contentView addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(doctorIcon.mas_bottom).offset(10);
    }];
    
    //医院
    UILabel *hospitalLabel = [[UILabel alloc]init];
    self.hospitalLabel = hospitalLabel;
    
    hospitalLabel.text = @"hospital";
    hospitalLabel.font = BOLDFONT(11);
    
    [self.contentView addSubview:hospitalLabel];
    
    [hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(nameLabel.mas_bottom).offset(5);
    }];
    
    
    
}

-(void)setModel:(FocusDoctorModel *)model{
    
    self.nameLabel.text = model.doctor_name;
    self.hospitalLabel.text = model.doctor_hospital_name;
        
    [self.doctorIcon sd_setImageWithURL:[NSURL URLWithString:model.doctor_portrait] placeholderImage:[UIImage imageNamed:@"illness_img_person.png"]];
    
}


@end
